import { createRouter, createWebHistory } from 'vue-router'
//引入icon
import {
  HomeFilled,
  UserFilled,
  Setting,
  InfoFilled,
  LocationInformation,
  ChatLineRound
} from '@element-plus/icons-vue'


//设置路由表
export const root=[
  {
    path:'/home',
    component:()=>import('@/views/home.vue'),
    meta:{
      tit:'首页',
      icon:HomeFilled
    }
  },
  {
    path:'/user',
    component:()=>import('@/views/user.vue'),
    meta:{
      tit:'个人中心',
      icon:UserFilled
    },
    children:[
      {
        path:'/userinfo',
        component:()=>import('@/views/userinfo.vue'),
        meta:{
          tit:'用户信息',
          icon:InfoFilled
        }
      },
      {
        path:'/useradd',
        component:()=>import('@/views/useradd.vue'),
        meta:{
          tit:'地址管理',
          icon:LocationInformation
        }
      },
    ]
  },
  {
    path:'/bis',
    component:()=>import('@/views/bis.vue'),
    meta:{
      tit:'栅格布局',
      icon:ChatLineRound
    }
  },
  {
    path:'/setting',
    component:()=>import('@/views/setting.vue'),
    meta:{
      tit:'设置',
      icon:Setting
    }
  },
]

const routes:any=[
  ...root,
  
  {
    path:'/',
    redirect:'/home'
  },
  
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
